from django.db import models
from datetime import datetime

# Create your models here.
class YsbCompanyInfo(models.Model):
    id = models.AutoField(verbose_name='id', primary_key=True)
    user_id = models.CharField(max_length=150, verbose_name='id', default='')
    company_name = models.CharField(max_length=150, verbose_name='客户公司名称', default='公司名称未填写')
    mobile = models.CharField(max_length=150, verbose_name='手机号',null=True,default='')
    sign_date = models.DateTimeField(max_length=150, verbose_name='签约时间', default=datetime.now)
    expire_date = models.DateTimeField(max_length=150, verbose_name='合约到期时间', default=datetime.now)
    service_cycle = models.CharField(max_length=150, verbose_name='服务周期', default='',editable=False)
    service_price = models.CharField(max_length=150, verbose_name='服务费用', default='')
    ad_online_date  = models.DateTimeField(max_length=150, verbose_name='广告上线时间', default=datetime.now)
    ad_offline_date = models.DateTimeField(max_length=150, verbose_name='广告下线时间', default=datetime.now)

    class Meta:
        verbose_name = '易数宝公司信息'
        verbose_name_plural = verbose_name

    def __str__(self):
        return str(self.id)

class BaiduAppCompanyInfo(models.Model):
    id = models.AutoField(verbose_name='id', primary_key=True)
    user_id = models.CharField(max_length=150, verbose_name='用户id')
    company_name = models.CharField(max_length=150, verbose_name='公司名字')
    phone_number = models.CharField(max_length=150, verbose_name='联系方式')
    create_time = models.DateTimeField(verbose_name='创建日期',default=datetime.now,blank=True)
    visit_time = models.DateTimeField(verbose_name='更新日期',default=datetime.now,blank=True)
    app_name = models.CharField(max_length=10, verbose_name='应用来源')

    class Meta:
        verbose_name = '百度商业应用公司信息'
        verbose_name_plural = verbose_name

    def __str__(self):
        return str(self.id)

class ClarkiiSeoCompanyInfo(models.Model):
    id = models.AutoField(verbose_name='id',primary_key=True)
    user_id = models.BigIntegerField(verbose_name='用户id')
    company = models.CharField(max_length=50, verbose_name='用户名', default='')
    email = models.CharField(max_length=150, verbose_name='邮箱', default='')
    mobile = models.CharField(max_length=50, verbose_name='手机号', default='')
    start_time = models.DateTimeField(verbose_name='上线时间',default=datetime.now)
    end_time = models.DateTimeField(verbose_name='下线时间',default=datetime.now,blank=True)
    industry = models.CharField(max_length=150, verbose_name='行业', default='')
    mainBussiness = models.CharField(max_length=200, verbose_name='主营业务', default='')



    class Meta:
        verbose_name = 'ClarkiiSEO公司信息'
        verbose_name_plural = verbose_name

    def __str__(self):
        return str(self.id)

class SmsCompanyInfo(models.Model):
    id = models.AutoField(verbose_name='id', primary_key=True)
    company_name = models.CharField(max_length=255,  verbose_name='公司名', unique=True)
    url = models.CharField(max_length=255, verbose_name='公司域名', null=True, blank=True)
    phone = models.TextField(verbose_name='手机号', null=True, blank=True)
    city = models.CharField(max_length=255, verbose_name='所在城市', null=True, blank=True)
    create_time = models.DateTimeField(verbose_name='首次发现', default=datetime.now, blank=True)
    update_time = models.DateTimeField(verbose_name='最后更新', blank=True, null=True, default=None)
    keyword = models.CharField(max_length=255, verbose_name='搜索关键词', null=True, blank=True)
    discover_time = models.DateTimeField(verbose_name='最近发现时间', null=True, blank=True)
    discover_count = models.IntegerField(verbose_name='发现次数', default=1, null=False, blank=False)

    class Meta:
        db_table = 'sms_company'
        verbose_name = 'SMS公司信息'
        verbose_name_plural = verbose_name

    def __str__(self):
        return str(self.id)

class AllCompanyInfo(models.Model):
    id = models.AutoField(verbose_name='id', primary_key=True)
    company_name = models.CharField(max_length=255,  verbose_name='公司名', unique=True)
    phone = models.CharField(max_length=255, verbose_name='手机号', null=True, blank=True)
    source = models.CharField(max_length=255, verbose_name='信息来源', null=True, blank=True)

    class Meta:
        db_table = 'all_company'
        verbose_name = 'ALL公司信息'
        verbose_name_plural = verbose_name

    def __str__(self):
        return str(self.id)